#!usr/bin/env python
# -*- coding:utf-8 -*-
# user nanme: Mr.zhang
# data1 time : 2022/5/9   10:37 上午
# project   : auto_start.py
# IDE       : PyCharm
# email     :17600960626@163.com
import logging
import os
import time

from auto_xposed.auto_kika import Auto_kika
from public.sql_language import sql_devices, fu_language, zhu_language
from public.uninstall import Auto_uninstall

start_=Auto_kika()


class Auto_start(Auto_uninstall):

    def start_run(self,corpus_mode,sdk_name):
        for i in sql_devices():
            os.system(
                'adb -s %s shell ime enable com.huawei.ohos.inputmethod/com.android.inputmethod.latin.LatinIME' % i)
            os.system(
                'adb -s %s shell ime set com.huawei.ohos.inputmethod/com.android.inputmethod.latin.LatinIME ' % i)
        logging.warning('设置kika输入法')
        start_.multi_xpos(sql_devices()) # 自动运行
        #输入0为纠错，输入1为单语料测试，输入2为混合输入测试
        try:
            if corpus_mode == "0":
                start_.kika_error_input(sdk_name,sql_devices(),zhu_language())
            if corpus_mode == "1":
                start_.kika_alone_input(sdk_name,sql_devices(),zhu_language())
            if corpus_mode == "2":
                start_.kika_mixed_input(sdk_name,sql_devices(),zhu_language(),fu_language())
        except Exception as e:
            print(e,"输入错误，请重新启动")




